<template id="home">
  <div>
    <group title="2017-04-04">
      <scroller lock-x @on-scroll="onScroll" ref="scrollerEvent">
        <div>
          <div v-for="item in data" class="home-item">
            <p>{{ item.department }}：</p>
            <p>{{ item.content }}</p>
            <p>审批意见：</p>
            <p>{{ item.approve }}</p>
            <p>抄送单位：</p>
            <p>{{ item.notice }}</p>
            <p>{{ item.time }}</p>
          </div>
        </div>
      </scroller>
    </group>
  </div>
</template>
<script>
  var scrollTop;
  var home = {
    template: '#home',
    components: {
      scroller: vuxScroller,
      group: vuxGroup,
    },
    data: function() {
      return {
        data: [],
        status: '',
      }
    },
    methods: {
      onScroll: function(pos) {
        if (pos.top != 0) {
          scrollTop = pos.top
        }
      },
      pull: function() {

      }
    },
    beforeCreate: function() {
      // this.$vux.loading.show({
      //   text: 'Loading'
      // })
      var _this = this
      axios.get('get_home')
        .then(function(res) {
          _this.data = res.data
          // _this.$root.$vux.loading.hide()
        })
    },
    updated: function() {
      this.$refs.scrollerEvent.reset({top: scrollTop})
    }
  }
</script>
<style>
  .home-item {
    height: 135px;
    margin: 5px;
    padding: 5px;
    border-bottom: 1px solid #eee;
    font-size: 14px;
  }
</style>
